#include<bits/stdc++.h>
using namespace std;
int n,q;
struct node{int num,id,pos;}a[1000000];
void sort0(){
	for(int i=1;i<=n;i++)
		for(int j=i;j>=2;j--)
			if(a[j].num<a[j-1].num)swap(a[j],a[j-1]);
}
int cmp(node x,node y){return x.id<y.id;};
int main()
{
	freopen("sort.in","r",stdin);
	freopen("sort.out","w",stdout);
	scanf("%d%d",&n,&q);
	for(int i=1;i<=n;i++){scanf("%d",&a[i].num);a[i].id=i;}
	sort0();
	for(int i=1;i<=n;i++)a[i].pos=i;
	sort(a+1,a+n+1,cmp);
	while(q--){
		int d,x,y;
		scanf("%d%d",&d,&x);
		if(d==2)printf("%d\n",a[x].pos);
		else {
			scanf("%d",&y);
			a[x].num=y;
			sort0();
			for(int i=1;i<=n;i++)a[i].pos=i;
			sort(a+1,a+n+1,cmp);
		}
	}
	return 0;
}
